<template>
  <div class="app-container">
    <div class="header">
      <h1>DIY Form 数据迁移工具</h1>
      <p>前后端分离架构，提供精准执行日志</p>
    </div>
    
    <div class="main-content">
      <MigrationTool @show-logs="showLogs = true" />
      
      <div class="log-viewer-container" :class="{ 'log-viewer-open': showLogs }">
        <button class="toggle-logs-btn" @click="showLogs = !showLogs">
          {{ showLogs ? '隐藏日志' : '查看执行日志' }}
        </button>
        
        <LogViewer v-if="showLogs" />
      </div>
    </div>
    
    <!-- <div class="footer">
      <p>数据迁移工具 v1.0 | 前后端分离架构</p>
    </div> -->
  </div>
</template>

<script setup>
import { ref } from 'vue';
import MigrationTool from './components/MigrationTool.vue';
import LogViewer from './components/LogViewer.vue';

const showLogs = ref(false);
</script>

<style scoped>
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-height: 100vh;
  background-color: #f5f7fa;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.header {
  background: linear-gradient(135deg, #3498db, #2c3e50);
  color: white;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
  margin: 0;
  font-size: 28px;
}

.header p {
  margin: 8px 0 0;
  opacity: 0.9;
}

.main-content {
  display: flex;
  flex: 1;
  padding: 20px;
  gap: 20px;
}

.log-viewer-container {
  width: 35%;
  background-color: #2c3e50;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  position: relative;
}

.log-viewer-open {
  width: 35%;
}

.toggle-logs-btn {
  position: absolute;
  top: -40px;
  right: 20px;
  background-color: #3498db;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s;
}

.toggle-logs-btn:hover {
  background-color: #2980b9;
}

.footer {
  background-color: #2c3e50;
  color: white;
  text-align: center;
  padding: 15px;
  font-size: 14px;
}
</style>